package com.jack.xiaoer.entity;

import com.jack.xiaoer.constant.ProductStateEnum;
import com.jack.xiaoer.validator.Groups;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.NotEmpty;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Min;
import java.math.BigDecimal;
import java.time.Instant;

/**
 * Created by Jackaroo Zhang on 2018/12/13.
 */
public class Product {

    private Long id;

    @Min(value = 1, message = "商家ID不能小于0", groups = {Groups.ProductCreate.class})
    private Long shopId;

    @NotBlank(message = "商品名称不能为空", groups = {Groups.ProductCreate.class})
    private String name;

    private String title;

    private String description;

    private String pictureUrl;

    private String pictureLargeUrl;

    private String property;

    @Range(min = 0, max = 10000, message = "商品价格必须在0~10000之间", groups = {Groups.ProductCreate.class})
    private BigDecimal price;

    private Integer minOrderCount;

    private String unit;

    private Integer boxNum;

    private BigDecimal boxPrice;

    private String categoryName;

    private Long category_id;

    private ProductStateEnum state;

    private Instant gmtCreate;

    private Instant gmtModified;

    @Override
    public String toString() {
        return "Product{" +
                "id=" + id +
                ", shopId=" + shopId +
                ", name='" + name + '\'' +
                ", title='" + title + '\'' +
                ", description='" + description + '\'' +
                ", pictureUrl='" + pictureUrl + '\'' +
                ", pictureLargeUrl='" + pictureLargeUrl + '\'' +
                ", property='" + property + '\'' +
                ", price=" + price +
                ", minOrderCount=" + minOrderCount +
                ", unit='" + unit + '\'' +
                ", boxNum=" + boxNum +
                ", boxPrice=" + boxPrice +
                ", categoryName='" + categoryName + '\'' +
                ", category_id=" + category_id +
                ", state=" + state +
                ", gmtCreate=" + gmtCreate +
                ", gmtModified=" + gmtModified +
                '}';
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getShopId() {
        return shopId;
    }

    public void setShopId(Long shopId) {
        this.shopId = shopId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getPictureUrl() {
        return pictureUrl;
    }

    public void setPictureUrl(String pictureUrl) {
        this.pictureUrl = pictureUrl;
    }

    public String getPictureLargeUrl() {
        return pictureLargeUrl;
    }

    public void setPictureLargeUrl(String pictureLargeUrl) {
        this.pictureLargeUrl = pictureLargeUrl;
    }

    public String getProperty() {
        return property;
    }

    public void setProperty(String property) {
        this.property = property;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public Integer getMinOrderCount() {
        return minOrderCount;
    }

    public void setMinOrderCount(Integer minOrderCount) {
        this.minOrderCount = minOrderCount;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public Integer getBoxNum() {
        return boxNum;
    }

    public void setBoxNum(Integer boxNum) {
        this.boxNum = boxNum;
    }

    public BigDecimal getBoxPrice() {
        return boxPrice;
    }

    public void setBoxPrice(BigDecimal boxPrice) {
        this.boxPrice = boxPrice;
    }

    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }

    public Long getCategory_id() {
        return category_id;
    }

    public void setCategory_id(Long category_id) {
        this.category_id = category_id;
    }

    public ProductStateEnum getState() {
        return state;
    }

    public void setState(ProductStateEnum state) {
        this.state = state;
    }

    public Instant getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Instant gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public Instant getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(Instant gmtModified) {
        this.gmtModified = gmtModified;
    }
}
